'use strict';

angular.module('myapp', ['ngRoute', 'ngResource', 'ngMaterial', 'angularFileUpload', 'ng-chrome-cast-channels']);


angular.module('myapp')
    .config(['$mdThemingProvider', function ($mdThemingProvider) {
        var customBlueMap = $mdThemingProvider.extendPalette('light-blue', {
            'contrastDefaultColor': 'light',
            'contrastDarkColors': ['50'],
            '50': 'ffffff'
        });
        $mdThemingProvider.definePalette('customBlue', customBlueMap);
        $mdThemingProvider.theme('default')
            .primaryPalette('customBlue', {
                'default': '500',
                'hue-1': '50'
            })
            .accentPalette('pink');
        $mdThemingProvider.theme('input', 'default')
            .primaryPalette('grey')
    }]);


angular.module('myapp').config(['$routeProvider',
  function ($routeProvider) {
        $routeProvider.
        when('/dashboard', {
            templateUrl: 'views/dashboard.html',
            controller: 'dashboardCtrl'
        }).
        when('/playlist', {
            templateUrl: 'views/playlist.html',
            controller: 'playlistCtrl'
        }).
        otherwise({
            redirectTo: '/playlist'
        });
  }]);


angular.module('myapp').run(['ChromeCastSenderChannel', '$mdToast', function (ChromeCastSenderChannel, $mdToast) {

    ChromeCastSenderChannel.initialize(appId, messageNS,
        function () {
            $mdToast.show($mdToast.simple().content('ChromeCast initialized'));
        },
        function (e) {
            $mdToast.show($mdToast.simple().content('ChromeCast status: ' + e));
        },
        function (e) {
            $mdToast.show($mdToast.simple().content('ChromeCast error: ' + e));
        });
}]);
